package com.peng.pojo;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Objects;

@Table(name = "tb_account", schema = "springboot-tuofu", catalog = "")
public class Account implements Serializable {
    private int id;
    private double balance;
    private int status;
    private Double totalConsumption;

    @Id
    @Column(name = "id")
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "balance")
    public double getBalance() {
        return balance;
    }

    public void setBalance(double balance) {
        this.balance = balance;
    }

    @Basic
    @Column(name = "status")
    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    @Basic
    @Column(name = "total_consumption")
    public Double getTotalConsumption() {
        return totalConsumption;
    }

    public void setTotalConsumption(Double totalConsumption) {
        this.totalConsumption = totalConsumption;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Account account = (Account) o;
        return id == account.id &&
                Double.compare(account.balance, balance) == 0 &&
                status == account.status &&
                Objects.equals(totalConsumption, account.totalConsumption);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, balance, status, totalConsumption);
    }
}
